package com.hsh.vo.dto;

import com.fasterxml.jackson.annotation.JsonIgnore;
import com.google.common.collect.Sets;
import com.hsh.entity.DbMenu;
import com.hsh.entity.DbRole;
import com.hsh.entity.DbUser;
import io.swagger.annotations.ApiModelProperty;
import lombok.AllArgsConstructor;
import lombok.Data;
import lombok.NoArgsConstructor;
import lombok.experimental.Accessors;
import org.checkerframework.checker.units.qual.A;

import java.io.Serializable;
import java.util.Collections;
import java.util.List;
import java.util.Set;

@Data
@AllArgsConstructor
@NoArgsConstructor
@Accessors(chain = true)
public class ActiveUser implements Serializable {

    private static final long serialVersionUID = 1L;

    @ApiModelProperty(value = "用户id", hidden = true)
    @JsonIgnore
    private String userId;

    @ApiModelProperty(value = "密码", hidden = true)
    @JsonIgnore
    private String password;


    @ApiModelProperty(value = "y盐", hidden = true)
    @JsonIgnore
    private String salt;
    /**
     * 当前用户对象
     */
    @ApiModelProperty(value = "用户对象，仅作测试使用，不予返回", hidden = true)
    @JsonIgnore
    private DbUser user;

    @ApiModelProperty(value = "token")
    private String token;

    /**
     * 登录类型
     */
    private String loginType;

    /**
     * 当前用户具有的角色
     */
    private List<DbRole> roles = Collections.emptyList();
    /**
     * 当前用户具有的url
     */
    private Set<String> urls = Sets.newHashSet();

    /**
     * 包括url+permission
     */
    private List<DbMenu> menus = Collections.emptyList();
    /**
     * 当前用户具有的权限API:例如[user:add],[user:delete]...
     */
    private Set<String> permissions = Sets.newHashSet();

    /**
     * 用户名称【唯一】
     */
    private String username;
    /**
     * 用户昵称【昵称 不唯一】
     */
    private String nickname;
    /**
     * 用户主机地址
     */
    private String host;
    /**
     * 用户登录时系统 IP
     */
    private String systemHost;
    /**
     * 所在地
     */
    private String location;

    /**
     * 用户部门信息
     */
    private boolean deptFlag = false;
}
